package com.cmccgz.udacs_landlord_webapp.bean;

import android.content.Context;
import android.util.Log;

import com.cmccgz.baselibrary.utils.MD5Utils;
import com.cmccgz.udacs_landlord_webapp.base.AppConfig;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author: Huang
 * @Descripion:
 * @date 2017/6/16 14:33
 */

public class AuthBean implements Serializable {

    private String mobile;
    private String token;
    private String imei;
    private String imsi;
    /////////////////////udacs!@#
    private String timestamp;
    AuthBean(Context context) {
        this(context,AppConfig.getMobile(context));
    }

    AuthBean(Context context,String mobile){
        this.mobile = mobile;
        token = AppConfig.getToken(context);
        imei = AppConfig.getIMEI(context);
        imsi = AppConfig.getIMSI(context);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        timestamp=sdf.format(new Date().getTime());
        String key="udacs!@#";
        String str = mobile + timestamp + key;
        token=MD5Utils.LongMD5(str);
        Log.v("AuthBean", "AuthBean: str=  "+str );
        Log.v("AuthBean", "AuthBean: token=  "+token );
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public String getImsi() {
        return imsi;
    }

    public void setImsi(String imsi) {
        this.imsi = imsi;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }
}
